const tags ={
    name: "cinemas",
    description: "影院管理模块",
};


const schemas = {
    cinemas: {
        // 用来描述用户的属性
        properties: {
            _id: {
                type: "string",
                description: "影院唯一标识",
            },
            phone: {
                type: "string",
                description: "影院联系方式",
            },
            address: {
                type: "string",
                description: "影院地址",
            },
            status: {
                type: "Boolean",
                description: "管理员密码",
            },
            imgs: {
                type: "string",
                description: "影院图片",
            },
            name: {
                type: "string",
                description: "影院名称",
            },
        },
    },
   
   ArrayOfcinemas: {
        properties: {
            total: {
                type: "number",
                description: "总数",
            },
            maxPage: {
                type: "number",
                description: "总页数",
            },
            rows: {
                type: "array",
                description: "影院",
                items: {
                    $ref: "#/components/schemas/cinemas",
                },
            },
        },
    },

    imgsOfcinemas:{
        properties: {
            _id: {
                type: "string",
                description: "用户唯一标识",
            },
             imgs: {
                type: "string",
                description: "影院图片",
            },
        },
    },
};



const paths = {
    //获取影院
 "/cinemas": {
        get: {
            tags: ["cinemas"],
            summary: "获取影院信息",
            description: "",
            consumes: ["application/json"],
            // 参数
            parameters: [
                {
                    name: "curPage",
                    in: "query",
                    schema: {
                        type: "integer",
                        default: 1,
                    },
                    required: true,
                    description: "当前页码",
                },
                {
                    name: "eachPage",
                    in: "query",
                    schema: {
                        type: "integer",
                        default: 1,
                    },
                    required: true,
                    description: "每页条数",
                },
            ],
            responses: {
                200: {
                    description: "操作成功",
                    content: {
                        "application/json": {
                            schema: {
                                $ref: "#/components/schemas/ArrayOfStudents",
                            },
                        },
                    },
                },
                404: {
                    description: "找不到资源",
                },
            },
        },
    },

//新增一个影院
    "/cinemas/add": {
        post: {
            tags: ["cinemas"],
            summary: "新增影院信息",
            description: "",
            // 请求参数
            requestBody: {
                // 必填
                required: true,
                // 内容
                content: {
                    "application/json": {
                        // 结构
                        schema: {
                            $ref: "#/components/schemas/cinemas",
                        },
                        example: {
                            name: "万达影城",
                            status: true,
                            phone: "133333333",
                            address:"浦东新区",
                            imgs:"https://iknow-pic.cdn.bcebos.com/f5c6efe1f3a292cf578b2"

                        },
                    },
                },
            },
            responses: {
                200: {
                    description: "操作成功",
                    content: {
                        "application/json": {
                            schema: {
                                $ref: "#/components/schemas/cinemas",
                            },
                        },
                    },
                },
                404: {
                    description: "类型错误",
                },
            },
        },
    },

//查找影院
    "/cinemas/:_id": {
        post: {
            tags: ["cinemas"],
            summary: "查找影院",
            description: "",
            // 请求参数
            requestBody: {
                // 必填
                required: true,
                // 内容
                content: {
                    "application/json": {
                        // 结构
                        schema: {
                            $ref: "#/components/schemas/cinemas",
                        },
                        example: {
                            _id:"_87893745238098349243"

                        },
                    },
                },
            },
            responses: {
                200: {
                    description: "操作成功",
                    content: {
                        "application/json": {
                            schema: {
                                $ref: "#/components/schemas/cinemas",
                            },
                        },
                    },
                },
                404: {
                    description: "类型错误",
                },
            },
        },
    },
    

    //修改影院
    "/change": {
        patch: {
            tags: ["cinemas"],
            summary: "修改影院信息",
            description: "",
            // 请求参数
            requestBody: {
                // 必填
                required: true,
                // 内容
                content: {
                    "application/json": {
                        // 结构
                        schema: {
                            $ref: "#/components/schemas/cinemas",
                        },
                        example: {
                            name: "万达影城",
                            status: true,
                            phone: "133333333",
                            address:"浦东新区",
                            imgs:"https://iknow-pic.cdn.com/f5c6efe1f3a292cf578b2",
                            _id:"_87893745238098349243",
                        },
                    },
                },
            },
            responses: {
                200: {
                    description: "操作成功",
                    content: {
                        "application/json": {
                            schema: {
                                $ref: "#/components/schemas/cinemas",
                                
                            },
                        },
                    },
                },
                404: {
                    description: "类型错误，操作失败",
                },
            },
        },
    },

//删除影院
     "/delete/:_id": {
        delete: {
            tags: ["cinemas"],
            summary: "删除影院信息",
            description: "",
            // 请求参数
            requestBody: {
                // 必填
                required: true,
                // 内容
                content: {
                    "application/json": {
                        // 结构
                        schema: {
                            $ref: "#/components/schemas/cinemas",
                        },
                        example: {
                            name: "万达影城",
                            status: true,
                            phone: "133333333",
                            address:"浦东新区",
                            imgs:"https://iknow-pic.cdn.bcebos.com/f5c6efe1f3a292cf578b2",
                            _id:"_87893745238098349243",
                        },
                    },
                },
            },
            responses: {
                200: {
                    description: "操作成功",
                    content: {
                        "application/json": {
                            schema: {
                                $ref: "#/components/schemas/cinemas",
                                
                            },
                        },
                    },
                },
                404: {
                    description: "类型错误，操作失败",
                },
            },
        },
    },
    


//删除影院图片

    "/cinemas/:_id":{
        patch: {
            tags: ["cinemas"],
            summary: "上传影院图片",
            description: "",
            // 请求参数
            requestBody: {
                // 必填
                required: true,
                // 内容
                content: {
                    "application/json": {
                        // 结构
                        schema: {
                            $ref: "#/components/schemas/imgsOfcinemas",
                        },
                        example: {
                            _id:"_87893745238098349243",
                            imgs:"https://iknow-pic.cdn.bcebos.com/f5c6efe1f3a292cf578b2",

                        },
                    },
                },
            },
            responses: {
                200: {
                    description: "操作成功",
                    content: {
                        "application/json": {
                            schema: {
                                $ref: "#/components/schemas/cinemas",
                            },
                        },
                    },
                },
                404: {
                    description: "类型错误",
                },
            },
        },
    },

"/cinemas/:_id": {
        delete: {
            tags: ["cinemas"],
            summary: "删除影院图片",
            description: "",
            // 请求参数
            requestBody: {
                // 必填
                required: true,
                // 内容
                content: {
                    "application/json": {
                        // 结构
                        schema: {
                            $ref: "#/components/schemas/imgsOfcinemas",
                        },
                        example: {
                            _id:"_87893745238098349243",
                            imgs:"https://iknow-pic.cdn.bcebos.com/f5c6efe1f3a292cf578b2",

                        },
                    },
                },
            },
            responses: {
                200: {
                    description: "操作成功",
                    content: {
                        "application/json": {
                            schema: {
                                $ref: "#/components/schemas/cinemas",
                            },
                        },
                    },
                },
                404: {
                    description: "类型错误",
                },
            },
        },
    },
}
module.exports = { tags, schemas, paths }

